cd "///insert path here///"
use genderedcongruence_originaldata.dta, clear



	  
**************STEP 1: IDENTIFYING THE GENDER GAP IN REPRESENTATION**************


***A: t-tests (over all policy areas and separately)
mat T = J(2,4,.)
ttest women_parliament_congruence==men_parliament_congruence , unpaired
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest1.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if religious_principle==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest2.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if sociallifestyle==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest3.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if redistribution==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest4.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if deregulation==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest5.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if immigrate_policy==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest6.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if multiculturalism==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest7.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")

ttest women_parliament_congruence==men_parliament_congruence if environment==1
mat T[2,1] = r(mu_1)
mat T[2,2] = r(mu_2)
mat T[2,3] = r(mu_1) - r(mu_2)
mat T[2,4] = r(p)
mat rownames T = women_parliament_congruence men_parliament_congruence
frmttable using ttest8.doc, statmat(T) varlabels replace ///
	ctitle("", Men (mean), Women (mean), Difference, "p-value")











**************STEP ": EXPLAINING THE GENDER GAP IN POLICY CONGRUENCE**************




***MODEL 1: BASELINE MODEL
reg gendered_congruence womenproportion voting_gap , vce(cluster cntry)
estimates store model1


***FIGURE 2
margins, at(womenproportion=(10 (1) 50))
marginsplot
graph save womenproportion, replace
margins, at(voting_gap=(-9 (1) 8))
marginsplot
graph save voting_gap, replace
graph combine womenproportion.gph voting_gap.gph  , ycommon




***MODEL 2: MODEL WITH POLICY FIELDS
reg gendered_congruence  womenproportion voting_gap environment multiculturalism, vce(cluster cntry)
estimates store model2

***MODEL 3: INSTITUTIONAL CONTROLS 
reg gendered_congruence womenproportion voting_gap district_magnitude closed_list number_parliamentaryseats_log leftwing_strength, vce(cluster cntry)
estimates store model3

***MODEL 4: SOCIO-ECONOMIC CONTROLS
reg gendered_congruence womenproportion voting_gap womenlabourforceparticipation cee_country, vce(cluster cntry)
estimates store model4




***TABLE 2
esttab model1 model2 model3 model4 using ///
"TABL2.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
nonumbers mtitles("Model 1" "Model 2" "Model 3" "Model 4") ///
star(a 0.15 * 0.10 ** 0.05 *** 0.01) r2  replace 








**************STEP 3: ROBUSTNESS CHECKS**************



*****TEST1-4: DIFFERENT SAMPLES

***TEST1: Model with all observations with 10% stat. sign gender difference in preferences
use genderedcongruence_extendeddata.dta.dta, clear
reg gendered_congruence womenproportion voting_gap, vce(cluster cntry)
estimates store test1

***TEST2: Sample based on stat. sign. differences in distribution (5%-level) according to Kolmogorov�Smirnov test
use genderedcongruence_ksmirnovdata.dta, clear
reg gendered_congruence womenproportion voting_gap , vce(cluster cntry)
estimates store test2

***TEST3: excluding religious principles, multiculturalism,  social lifestyle, and redistribution
use genderedcongruence_originaldata.dta, clear
reg gendered_congruence womenproportion voting_gap if religious_principle==0 & multiculturalism ==0 & sociallifestyle ==0  & redistribution ==0, vce(cluster cntry)
estimates store test3

***TEST4: including only  religious principles, multiculturalism, social lifestyle, and redistribution
reg gendered_congruence womenproportion voting_gap if religious_principle==1 | multiculturalism ==1 | sociallifestyle ==1 | redistribution ==1, vce(cluster cntry)
estimates store test4



***TEST5-6: DIFFERENT OPERATIONALIZATIONS OF THE DEPENDENT VARIABLE

***TEST5: other indices for citizens' preferences
use genderedcongruence_alternativeindicesdata.dta, clear
reg gendered_congruence womenproportion voting_gap, vce(cluster cntry)
estimates store test5

***TEST6: difference between women-parliament-congruence and men-parliament congruence instead of ratio
use genderedcongruence_originaldata.dta, clear
generate dif_gendered_congruence= women_parliament_congruence-men_parliament_congruence
reg dif_gendered_congruence womenproportion voting_gap , vce(cluster cntry)
estimates store test6



*****TEST 7 to 9: DIFFERENT OPERATIONALIZATIONS OF EXPLANATORY  VARIABLES AND THEIR INTERACTIONS

***TEST7: Share of female office-holders at CHES election
reg gendered_congruence womenproportion_ches voting_gap , vce(cluster cntry)
estimates store test7

***TEST8: Share of female office-holders at election before CHES election
reg gendered_congruence womenproportion_pre_ches voting_gap , vce(cluster cntry)
estimates store test8

***TEST9: Interaction between gender-gap in voting and electoral rules
reg gendered_congruence womenproportion c.voting_gap##c.district_magnitude closed_list number_parliamentaryseats_log leftwing_strength, vce(cluster cntry)
estimates store test9






*****TEST 10 to 12: DIFFERENT CONTROL VARIABLES

***TEST10: Including right-wing government
reg gendered_congruence womenproportion voting_gap disproportionality enp closed_list number_parliamentaryseats_log rightwing_government, vce(cluster cntry)
estimates store test10

***TEST11: Interaction between the share of women and women's preference distribution
reg gendered_congruence c.womenproportion##c.sd_difference_gender voting_gap , vce(jacknife)
estimates store test11

***TEST12: all relevant control variables in one model
reg gendered_congruence womenproportion voting_gap  environment multiculturalism district_magnitude closed_list number_parliamentaryseats_log leftwing_strength womenlabourforceparticipation cee_country, vce(cluster cntry)
estimates store test12




*****TEST 13: DIFFERENT MODELLING STRATEGIES

***TEST13: Model 1 with Jackknife Standard Errors
reg gendered_congruence womenproportion voting_gap, vce(jacknife)
estimates store test13





*****TEST14-20: SEPARATE MODELS FOR POLICY AREAS
reg gendered_congruence womenproportion voting_gap if religious_principle==1
estimates store test14
reg gendered_congruence womenproportion voting_gap if multiculturalism==1
estimates store test15
reg gendered_congruence womenproportion voting_gap if deregulation==1
estimates store test16
reg gendered_congruence womenproportion voting_gap if redistribution==1
estimates store test17
reg gendered_congruence womenproportion voting_gap if immigrate_policy==1
estimates store test18
reg gendered_congruence womenproportion voting_gap if sociallifestyle==1
estimates store test19
reg gendered_congruence womenproportion voting_gap if environment==1
estimates store test20










***Appendix 7.1
esttab test1 test2 test3 test4 test5 test6  using ///
"appendix7_1.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
nonumbers mtitles("Test 1" "Test 2" "Test 3" "Test 4" "Test 5" "Test 6") ///
star(a 0.15 * 0.10 ** 0.05 *** 0.01) r2  replace 



***Appendix 7.2
esttab test7 test8 test9 test10 test11 test12 test13 using ///
"appendix7_2.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
nonumbers mtitles("Test 7" "Test 8" "Test 9" "Test 10" "Test 11" "Test 12" "Test 13") ///
star(a 0.15 * 0.10 ** 0.05 *** 0.01) r2  replace 



***Appendix 7.3
esttab  test14 test15 test16 test17 test18 test19 test20 using ///
"appendix7.3.rtf", ///
cells (b(star fmt(4)) se(par fmt(4))) compress ///
legend label title(Regression models) ///
nonumbers mtitles("Religious Principle" "Multiculturalism" "Deregulation" "Redistribution" "Immigration policy" "Social lifestyle" "Environment") ///
star(a 0.15 * 0.10 ** 0.05 *** 0.01) r2  replace 




***Appendix 6 FIGURE
generate policy_area=""
replace policy_area="Immigration" if immigrate_policy==1
replace policy_area="Redistribution" if redistribution==1
replace policy_area="Free market" if deregulation==1
replace policy_area="Religious principle" if religious_principle==1
replace policy_area="Multiculturalism" if multiculturalism==1
replace policy_area="Environment" if environment==1
replace policy_area="Social lifestyle" if sociallifestyle==1

      
twoway (scatter women_parliament_congruence men_parliament_congruence, mlabel(cntry)) (lfit women_parliament_congruence women_parliament_congruence)
graph save appendix61, replace
twoway (scatter women_parliament_congruence men_parliament_congruence if immigrate_policy==1)(scatter women_parliament_congruence men_parliament_congruence if redistribution==1)  (scatter women_parliament_congruence men_parliament_congruence if deregulation==1)  (scatter women_parliament_congruence men_parliament_congruence if religious_principle==1) (scatter women_parliament_congruence men_parliament_congruence if multiculturalism==1) (scatter women_parliament_congruence men_parliament_congruence if environment==1)  (scatter women_parliament_congruence men_parliament_congruence if sociallifestyle==1)  (lfit women_parliament_congruence women_parliament_congruence)
graph save appendix62, replace
graph combine appendix61.gph appendix62.gph
